<?php
   $username=$_GET['username'];
   $password=$_GET['password'];
   //连接mysql
   $connect=mysql_connect("localhost","root","192510");
   mysql_select_db("news",$connect);
   if($username&&$password){
	   $sql="select * from user where username='{$username}'&&password='{$password}'";
	   $result=mysql_query($sql);
		 $row=mysql_fetch_array($result);
		 session_start();
		 $status=$row['status'];
		 $id=$row['id'];
		 $_SESSION['username']=$username;
		 $_SESSION['status']=$status;
		 $_SESSION['id']=$id;
         if(isset($status)){
			 if($status==0||$status==2){
				 echo "<script>location='main2.php';</script>";
			 }else{
				echo "<script>location='main.php';</script>";
			 }
		 }else{
			  echo "<script>location='login.php';</script>";
		 }	 
   }else{
	   
	     echo "<script>location='login.php';</script>";
   } 
?>
